//添加图片的坐标
var arr = [
    {x:-64, s:.83, z: 1},
    {x:140, s: 1, z: 2},
    {x:338, s:.83, z: 1},
    {x:960, s:.83, z: 1},
    {x:960, s:.83, z: 1},
    {x:960, s:.83, z: 1},
]
//给每个图片添加行内样式(为啥Z要分开写)
function style()
{
    let swiperObjs=document.querySelectorAll(".swiper .swiper-slide")
    swiperObjs.forEach((item,i)=>
    {
    item.style.transform=`translateX(${arr[i].x}px) scale(${arr[i].s}) `
    item.style.zIndex =arr[i].z
    })
}
style()
//点击下一张
function next()
{
    var temp=arr.pop()//后弹
    arr.unshift(temp)//前压
    style()
}
document.querySelector(".swiper .swiper-next").onclick = next 
//点击前面一张
function prev()
{
    var temp=arr.shift()//前弹
    arr.push(temp)//后压
    style()
}
document.querySelector(".swiper .swiper-prev").onclick=prev
//点击图片切换
document.querySelector(".swiper .swiper-wrapper").onclick=function(evt) {
    var e=evt ||window.event
    var target = e.target || e.srcElement
    if(target.parentNode.style.transform.includes("64px"))
{
    prev()
}
    if(target.parentNode.style.transform.includes("338px"))
{
    next() 
}}